﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Model;
using EntityServices;

namespace WebApp.Controllers
{
    public class 目录Controller : ApiController
    {
        public 目录Controller():base()
        {

        }
       NetworkmallEntityServicesFactory entityServices = new NetworkmallEntityServicesFactory();
        // GET api/<controller>
       public IEnumerable<目录> Get()
       {
         return entityServices.目录Services.GetList();
       }

        // GET api/<controller>/5
        public 目录 Get(int id)
        {
            return entityServices.目录Services.GetById(id);
        }

        // POST api/<controller>
        public void Post([FromBody]目录 value)
        {
            entityServices.目录Services.NewSave(value);
        }

        // PUT api/<controller>/5
        public void Put(int id, [FromBody]目录 value)
        {
            entityServices.目录Services.Modify(value);
        }

        // DELETE api/<controller>/5
        public void Delete(int id)
        {
            目录 temp = this.Get(id);
            if (temp != null)
                entityServices.目录Services.Remove(temp);
        }
    }
}